home *** CD-ROM | disk | FTP | other *** search
/ Aminet 44 / Aminet 44 (2001)(GTI - Schatztruhe)[!][Aug 2001].iso / Aminet / dev / gui / gtlayout.lha / Source / LTP_SizeDimensions.c < prev    next >
C/C++ Source or Header  |  1999-01-02  |  2KB  |  96 lines

  1. /*
  2. **    GadTools layout toolkit
  3. **
  4. **    Copyright © 1993-1999 by Olaf `Olsen' Barthel
  5. **        Freely distributable.
  6. **
  7. **    :ts=4
  8. */
  9.  
  10. #ifndef _GTLAYOUT_GLOBAL_H
  11. #include "gtlayout_global.h"
  12. #endif
  13.  
  14. #include "Assert.h"
  15.  
  16.  
  17. /*****************************************************************************/
  18.  
  19.  
  20. STATIC VOID
  21. LTP_GetSizeDimensions(LayoutHandle *Handle,ULONG *SizeWidth,ULONG *SizeHeight)
  22. {
  23.     Object    *SizeImage;
  24.     LONG     SizeType;
  25.  
  26.     if(Handle->Screen->Flags & SCREENHIRES)
  27.     {
  28.         if(SizeWidth)
  29.             *SizeWidth = 18;
  30.  
  31.         if(SizeHeight)
  32.             *SizeHeight = 10;
  33.  
  34.         SizeType = SYSISIZE_MEDRES;
  35.     }
  36.     else
  37.     {
  38.         if(SizeWidth)
  39.             *SizeWidth = 13;
  40.  
  41.         if(SizeHeight)
  42.             *SizeHeight = 11;
  43.  
  44.         SizeType = SYSISIZE_LOWRES;
  45.     }
  46.  
  47.     if(SizeImage = NewObject(NULL,SYSICLASS,
  48.         SYSIA_Size,        SizeType,
  49.         SYSIA_Which,    SIZEIMAGE,
  50.         SYSIA_DrawInfo,    Handle->DrawInfo,
  51.     TAG_DONE))
  52.     {
  53.         if(SizeWidth)
  54.             GetAttr(IA_Width,SizeImage,SizeWidth);
  55.  
  56.         if(SizeHeight)
  57.             GetAttr(IA_Height,SizeImage,SizeHeight);
  58.  
  59.         DisposeObject(SizeImage);
  60.     }
  61. }
  62.  
  63.  
  64. /*****************************************************************************/
  65.  
  66.  
  67. ULONG
  68. LTP_GetSizeWidth(struct LayoutHandle *handle)
  69. {
  70.     ULONG SizeWidth;
  71.  
  72.     LTP_GetSizeDimensions(handle,&SizeWidth,NULL);
  73.  
  74.     if(SizeWidth < handle->Screen->WBorRight)
  75.         return(handle->Screen->WBorRight);
  76.     else
  77.         return(SizeWidth);
  78. }
  79.  
  80.  
  81. /*****************************************************************************/
  82.  
  83.  
  84. ULONG
  85. LTP_GetSizeHeight(struct LayoutHandle *handle)
  86. {
  87.     ULONG SizeHeight;
  88.  
  89.     LTP_GetSizeDimensions(handle,NULL,&SizeHeight);
  90.  
  91.     if(SizeHeight < handle->Screen->WBorBottom)
  92.         return(handle->Screen->WBorBottom);
  93.     else
  94.         return(SizeHeight);
  95. }
  96.